package binfa;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class futuretask {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> futureTask=new FutureTask<>(new my());
        Thread t=new Thread(futureTask);
        t.start();
        System.out.println("获得的结果"+futureTask.get());

    }
    public static  class  my implements Callable<Integer> {

        @Override
        public Integer call() throws Exception {
            System.out.println("这是futuretask任务");
            return 1;
        }
    }
}
